package cn.kgc.crowdfundingadmin2.service;


import cn.kgc.crowdfundingadmin2.mapper.MenuMapper;
import cn.kgc.crowdfundingadmin2.pojo.Menu;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author shkstart
 * @create 郭祥伟
 */
@Service("menuService")
public class MenuServiceImpl implements MenuService {
    @Resource
    MenuMapper menuMapper;
    @Override
    public List<Menu> getAll() {
        return menuMapper.selectByExample(null);
    }
    @Override
    public void saveMenu(Menu menu) {
        menuMapper.insert(menu);
    }
    @Override
    public Menu getMenuById(Integer id) {
        return menuMapper.selectByPrimaryKey(id);
    }

    @Override
    public void update(Menu menu) {
        menuMapper.updateByPrimaryKeySelective(menu);
    }

    @Override
    public void delete(Integer id) {
        menuMapper.deleteByPrimaryKey(id);
    }
}
